<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background: green;
            position: absolute;
            left: 500px;
            top: 100px;
        }
        /* ------定义动画的6个状态---------- */
        /* 进来之前 -- 初始状态 */
        .aa-enter{  
            left:0px;
            opacity: 0;
            transform: scale(0.1,0.1);
        }
        /* 进来过程 -- 动画 */
        .aa-enter-active{
            transition: all 1s;
        }
        /* 进来完成 -- 结束状态*/
        .aa-enter-to{ 
            left:500px;
            opacity: 1;
            transform: scale(1,1);
        }


         /* 离开之前 -- 初始状态 */
         .aa-leave{  
            left:500px;
            opacity: 1;
            transform: rotate(0deg);
        }
        /* 离开过程 -- 动画 */
        .aa-leave-active{
            transition: all 1s;
        }
        /* 离开完成 -- 结束状态*/
        .aa-leave-to{ 
           left:1000px;
           opacity: 0;
           transform: rotate(1000deg);
        }
    </style>
</head>

<body>
    <!-- 定义挂载点 -->
    <div id="app">
        <button @click=" isShow = !isShow ">开关</button>
        <!-- 1.给谁加动画，就用transition标签嵌套他 
             2.给transition取名  name='名字'
             3.定义6个状态
        -->
        <transition name="aa">
            <div class="box" v-if="isShow"></div>
        </transition>


        
    </div>

    <script>
        new Vue({
            //挂载点
            el: "#app",
            //数据
            data: {
                isShow: false
            },
            //方法
            methods: {}
        })
    </script>
</body>

</html>